﻿using System.Web;

namespace PmfWeb.Core.Web
{
    ///<summary>
    /// 会话操作扩展类 飘渺峰整理 2008-11-18
    ///</summary>
    public static class Sessions
    {
        /// <summary>
        /// 判断当前会话是否存在
        /// </summary>
        /// <param name="name">会话名</param>
        /// <returns>存在返回true,反之返回false</returns>
        public static bool Exists(string name)
        {
            return null != HttpContext.Current.Session[name];
        }
        /// <summary>
        /// 移除Session,置空值.
        /// </summary>
        /// <param name="name">会话名</param>
        /// <returns>置空成功,返回true,反之返回false</returns>
        public static bool Remove(string name)
        {
            if (Exists(name))
            {
                HttpContext.Current.Session[name] = "";
                return true;
            }
            return false;
        }
        
    }
}
